home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / sh1_111.zip / MENU.SH < prev    next >
Text File  |  1987-09-07  |  2KB  |  76 lines

  1. if %# == 0
  2.   echo !
  3.   usage: menu <id> <x> <y> <header> <selection1> ...
  4.   MENU saves the current screen and displays a window containing
  5.   the given selections. The upper left corner of the window is
  6.   defined by <x> and <y>. The <id> should be a number in one of
  7.   two ranges:
  8.    1 .. 9       Once the menu is exited, the menu will be erased
  9.                 from the screen.
  10.    10 .. 99     The menu will stay on the screen after menu is
  11.                 exited. To remove a menu, execute the shell
  12.                 REMOVEM.SH with the menu <id>.
  13.  
  14.   MENU returns a number 1 thru # of selection items or a -1 if
  15.   the <esc> was pressed. You may access this return value thru the
  16.   use of the %%? special variable.
  17.   Once you are done with all menus, you can get rid of all screen
  18.   saving files by DELeting all SH1TMPS.* from the directory
  19.   specified by SH1FILES.
  20.  
  21.   Example:
  22.  
  23.     menu 1 10 10 "SW development" Edit Compile Link "Load and Run"
  24.   !
  25.   exit
  26. endif
  27.  
  28. local MENUY MENUX1 MENUID MENUH MENUN MENUX
  29.  
  30. MENUID=%1
  31. MENUX=%2
  32. compute MENUX1=%MENUX+2
  33. MENUY=%3
  34. MENUH=%4
  35. MENUN=1
  36. shift
  37. shift
  38. shift
  39. shift
  40. shx -scrs %{SH1FILES}sh1tmps.%MENUID
  41. gotoxy %MENUX %MENUY
  42. echo ┌────────────────────────┐_
  43. gotoxy %MENUX1 %MENUY
  44. echo  %MENUH ^^
  45. compute MENUY=%MENUY+1
  46. gotoxy %MENUX %MENUY
  47. echo │                        │_
  48. compute MENUY=%MENUY+1
  49. while '%1' != ''
  50.   gotoxy %MENUX %MENUY
  51.   echo │                        │_
  52.   gotoxy %MENUX1 %MENUY
  53.   echo %MENUN  %1_
  54.   shift
  55.   compute MENUN=%MENUN+1
  56.   compute MENUY=%MENUY+1
  57. endwhile
  58. gotoxy %MENUX %MENUY
  59. echo │                        │_
  60. compute MENUY=%MENUY+1
  61. gotoxy %MENUX %MENUY
  62. echo └────────────────────────┘_
  63. compute MENUY=%MENUY-1
  64. gotoxy %MENUX1 %MENUY
  65. echo   Enter selection: _
  66. repeat
  67.   MENUX=%!
  68. until ('%MENUX' >= '1' & '%MENUX' < '%MENUN') | '%MENUX' == ''
  69. if %MENUID < 10
  70.   shx -scrl %{SH1FILES}sh1tmps.%MENUID
  71. endif
  72. if '%MENUX' == ''
  73.   MENUX=-1
  74. endif
  75. exit %MENUX
  76.